/**
 * FlatList ListEmptyComponent
 */
import React, { Component, PureComponent } from 'react';
import {
    StyleSheet,
    Dimensions,
    View,
    Text,
} from 'react-native';

const { width, height } = Dimensions.get('window');

export default class FlatListEmpty extends Component {
    constructor(props) {
        super(props);
        this.state = {
        };
    }

    static defaultProps = {
        show: true,
        text: '暂无数据',
    }

    componentDidMount() {
    }

    render() {
        if (!this.props.show) return null;

        return (
            <View style={[styles.emptyView, this.props.style]}>
                <Text style={styles.emptyText}>{this.props.text}</Text>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    emptyView: {
        justifyContent: 'center',
        alignItems: 'center',
        height: "100%",
    },
    emptyText: {
        fontSize: 14,
        color: '#585858',
    },
});
